package com.wdy.delegate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Optional;

/**
 * @ClassName: ServiceLookup
 * @Description: TODO
 * @Date: 2019/12/31 16:24
 * @Author: wangdy001
 * @Version: 1.0
 */
public class ServiceLookup {
    private static final Logger LOG = LoggerFactory.getLogger(ServiceLookup.class);


    public static Optional<BusinessService> getBusinessService(ServiceType serviceType) {
        LOG.error("ServiceLookup getBusinessService, serviceType={}", serviceType);
        if(ServiceType.EJB.equals(serviceType)) {
            return Optional.of(new EjbService());
        } else if(ServiceType.JMS.equals(serviceType)) {
            return Optional.of(new JmsService());
        } else {
            return Optional.empty();
        }
    }
}
